<script type="text/javascript" charset="iso-8859-1">
var currentID = '';


/***********
 * Form Submit function
 */


 AIM = {
 		frame : function(c) 
 		{
 	 		var n = 'f' + Math.floor(Math.random() * 99999);
 			var d = document.createElement('DIV');
 			d.innerHTML = '<iframe style="display:none" src="about:blank" id="'+n+'" name="'+n+'" onload="AIM.loaded(\''+n+'\')"></iframe>';
 			document.body.appendChild(d);
 	 		var i = document.getElementById(n);
 			if (c && typeof(c.onComplete) == 'function') 
 			{
 				i.onComplete = c.onComplete;
 			}
 	 		return n;
 		},
 	 	form : function(f, name) 
 	 	{
 			f.setAttribute('target', name);
 		},
 	 	submit : function(f, c) 
 	 	{
 			AIM.form(f, AIM.frame(c));
 			if (c && typeof(c.onStart) == 'function') 
 			{
 				return c.onStart();
 			} 
 			else 
 			{
 				return true;
 			}
 		},
 		loaded : function(id) 
 		{
 			var i = document.getElementById(id);
 			if (i.contentDocument) 
 			{
 				var d = i.contentDocument;
 			} 
 			else if (i.contentWindow) 
 			{
 				var d = i.contentWindow.document;
 			} 
 			else 
 			{
 				var d = window.frames[id].document;
 			}
 			if (d.location.href == "about:blank") 
 			{
 				return;
 			}
 	 		if (typeof(i.onComplete) == 'function') 
 		 	{
 				i.onComplete(d.body.innerHTML);
 			}
 		}
 	}

	
 /***********
  * POPUP
  */

 	 function openPopup(link, hoogte, breedte, titel)
 	 {
 	 	$(".popup").dialog('destroy');
 	 	$(".popup").dialog({
 	 		title: titel,
 	 		width: breedte,
 	 		height: hoogte,
 	 		modal: true,
 	 		autoOpen: false,
 	 		open: function(event, ui) {
 	 			//display correct dialog content
 	 			$(".popup").load(link);
 	 		}
 	 	});
 	 	$(".popup").dialog("open");
 	 	return false;
 	 }


	
/************
 * Display functies
 */
	function displayPage(id)
	{
		if(document.getElementById('catogorienLijst'))
			setTimeout("updateElement('catogorienLijst');", 1);
		if(document.getElementById('catogorieBewerken'))
			setTimeout("updateElement('catogorieBewerken');", 1);
	}

	function updateElement(elementID)
	{
		var element = document.getElementById(elementID);
		// update content
		if(element)
			$(element).load('containers/'+elementID+'.php');
		else
			alert('ERROR: '+elementID+'\nis niet gevonden op de pagina');
	}

/************
 * Navigatie Functies
 */
 

	$(document).ready(function()
	{
		setPageWidth();
		leftContainer = document.getElementById('containerLeft');
		rightContainer = document.getElementById('containerRight');
		middleContainer = document.getElementById('containerMiddle');
		
		$('body').css({'backgroundColor': '#e0e0e0'});
		$('.container').wrap('<div class="schaduwDiv" />');
		// place the shadow divs
		displayPage();
	});


	function setPageWidth()
	{
		var pageWidth = $('#pagina').width();   // returns height of browser viewport
		var windowWidth = $(window).width();   // returns height of browser viewport
		//alert(pageWidth + ' < 1400 || ' + windowWidth + ' < 1400');
		if(pageWidth < 1200 || windowWidth < 1200)
		{
			$('#pagina').css('width','1660px');   
			
		}
		else
		{
			$('#pagina').css('width','100%');
		}
	}

    $(window).resize(function() 
    {
		setPageWidth();
    });
</script>